package com.jiutian.cmsskitdev;

import com.jiutian.cmsskitdev.config.StageConfig;
import com.jiutian.cmsskitdev.controller.StageController;
import javafx.application.Application;
import javafx.stage.Stage;


public class Main extends Application {
    private StageController stageController;

    //这里后续可写成配置文件，或者封装起来
    public static String mainPageID = "mainPage";
    public static String mainPageRes = "/com/jiutian/cmsskitdev/mainPage.fxml";

    public static String loginViewID = "login";
    public static String loginViewRes = "/com/jiutian/cmsskitdev/login.fxml";

    public static String mainViewID = "MainView";
    public static String mainViewRes = "/com/jiutian/cmsskitdev/DeviceManage.fxml";



    @Override
    public void start(Stage stage) throws Exception{
//        stageController = new StageController();
//        stageController.addPrimaryStage(stage,"primaryStage");
//        stageController.LoaderStage("login", "/com/jiutian/cmsskitdev/DeviceManage.fxml", DECORATED);

//
        stageController = new StageController();

        //将主舞台交给控制器处理
        stageController.setPrimaryStage("stage", stage);

        //在启动时加载多个stage放到hashmap里面
        stageController.loadStage(loginViewID, loginViewRes);
        stageController.loadStage(mainPageID, mainPageRes);
        stageController.loadStage(mainViewID, mainViewRes);

        //显示MainView舞台
        stageController.setStage(mainPageID);
        //移除窗口
        //stageController.unloadStage(mainViewID, stage);


    }

    public static void main(String[] args) {
        StageConfig.init();
        launch(args);
    }
}
